Graphic and video images are often formed as an array of picture elements. The number of picture elements forming the image determines the resolution, or level of detail, of the image formed by these picture elements. The image is intended to be displayed for viewing on a display that also has individual picture elements. The display will also have a physical size and the display resolution is expressed in terms of picture elements per unit of length in each dimension, for example pixels per inch, or pixels per line. Often, the resolution of the image differs from the resolution of the display, and the image must be scaled to the display. Also, a display is often utilized to display multiple independent images, such as windows on a computer screen, or picture-in-picture images on a television screen. If the image has more pixels than the allocated display area, the image must be downscaled. In this way, the entire image is displayed, albeit at a lesser resolution. If the image has fewer pixels than the allocated display area, the image is upscaled. In this way, the entire allocated display area is utilized.
In addition to scaling an image for display, scaling is also applied, for example, to resize an image from a scanner to a printer, or from a video source to a storage device, etc. The terms input samples and output samples will be used hereinafter to define, in general, discrete values received from an input device and resultant discrete values provided to an output device. Conventionally, a scaling factor, S, is defined in terms of the number of input samples, M, divided by the number of output samples, L.
Integer scaling is straightforward; for example, to downscale by a factor of 2, each pair of input samples can be averaged to provide an output sample; to downscale by a factor of 3, each triplet of input samples is averaged and mapped to an output sample; to upscale by a factor of 2, an interpolated value between every pair of input samples can be provided, and so on. Such direct integer scaling, however, does not allow for fractional scaling, such as 4/3. A 4/3 scaling factor will produce three output samples for every four input samples. Although every fourth input sample could merely be ignored to effect a 4/3 scaling, the resultant output will not be as accurate of a representation of the image as an averaging process, and, the resultant output may contain aberrations caused by aliasing.
Conventionally, to scale an image by a factor of S=M/L, the image is first upscaled by a factor of L, then downscaled by a factor of M. In this manner, sequential integer scaling is used to perform fractional scaling. In a 4/3 example, each input sample provides 3 intermediate output samples, then every four of these intermediate values are processed to provide one output sample. This process, however, will cause aliasing unless the upscaled samples are bandlimited. The larger M is, the more complex the bandlimiting filter required to eliminate aliasing. Conventional systems which allow for user or application defined parameters M and L, such as user definable window sizes, typically contain continuously variable bandwidth digital low pass filters to effect this bandlimiting.
As is common in the art of filter design, optimizations can be effected in the design of filters so as to minimize the time required to process the samples, for example by parallel processing, or to minimize the circuit complexity, for example by using the same circuit repetitively in a sequential process.
FIG. 1 shows a conventional vector filter wherein the input samples 100 are applied sequentially to delay elements 101, 102, 103 to provide samples I0, I1, I2, and I3 that can be processed in parallel. Each of the samples I0, I1, I2, and I3 are multiplied by multipliers 110, 111, 112, and 113 by coefficients h3, h2, h1, and h0, respectively and summed at the adder 120 to produce an output sample 130. The circuit of FIG. 1 will produce a weighted average of 4 samples, and thus would be suited for scaling by a scaling factor having an M of 4: 4/1, 4/2, 4/3, 4/4, 4/5, etc. It would not be suitable, however, for a scaling factor of, for example, 8/5. To average 8 samples, four additional delayed samples, or taps, must be provided to the adder 120. To provide for scaling by a scaling factor S=M/L, in general, requires an M-tap filter, each tap requiring an additional delay-multiply stage. Thus, the conventional vector filter would be implemented as a k-tap filter with k being the maximum allowable M. A problem with this approach, however, is that it must include a tap for every allowable M, and whenever a user or application selects an M that is less than the maximum allowable M, a number of delay-multiply stages will be unused.
FIG. 2 shows a conventional sequential filter, having a single multiply-accumulate stage. Each input sample 100 is processed sequentially by multiplying the sample with a coefficient value coef(i) in multiplier 210. At each sequential clock cycle, a new input sample 100 and a corresponding new coefficient value coef(i) are provided. The product of the input sample 100 and its corresponding coefficient value coef(i) is added to a previously accumulated sum and stored as a new accumulated sum in a register 230. After M clock cycles, the register 230 contains the output sample value. Thus, a user or application selected scaling factor can be accommodated by merely increasing the number of clock cycles to the user or application selected M. The next output sample requires another M clock cycles. To provide L output samples within the period of M input samples requires the clock to operate at L times M times the input data rate. To operate at higher than the input data rate requires buffering to accumulate input samples, so that they can be provided to the filter at the higher rate. Additional multiply-accumulate stages may be operated in parallel to reduce the required clock rate proportionately, but again the conventional sequential filter needs to be designed for a highest allowable M and L. As with the conventional vector filter, inefficiencies result whenever the user or application selected M and L are less than the highest allowable values, because circuitry will be unused or underutilized.
Therefore, a need exists for a filter apparatus that performs fractional scaling with minimal circuit complexity and that optimizes the utilization of the circuitry over a wide range of user or application defined scaling factors. A need also exists for a filter that operates at the input data rate, to minimize the need for input data buffering.